package com.example.leetdemo.process;

import lombok.Data;

import java.util.Arrays;

@Data
public class Solution1995 {

        public int countQuadruplets(int[] nums) {
            int n = nums.length, ans = 0;
            int[] cnt = new int[10010];
            for (int c = n - 2; c >= 2; c--) {
                cnt[nums[c + 1]]++;
                for (int a = 0; a < n; a++) {
                    for (int b = a + 1; b < c; b++) {
                        ans += cnt[nums[a] + nums[b] + nums[c]];
                    }
                }
            }
            return ans;
        }

    public static void main(String[] args) {
        Solution1995 solution1995 = new Solution1995();
        System.err.println(solution1995.countQuadruplets(new int[] {1,1,1,3,5}));
    }

    public int countQuadruplets2(int[] nums) {
        int count = 0, n = nums.length;
        int[][][] arg = new int[nums.length + 1][110][4];
        for (int i = 4; i < n; i--) {

        }
        return count;
    }

}
